<?php
namespace Common\Model;
use Think\Model;

class ConfigModel extends Model{
	/**
	 * 获取配置信息
	 * @param  [type] $name       KEY
	 */
	public function get($name = '', $type='basic'){
		if($name){
			$where['name'] = $name;
		}
		if($type){
			$where['type'] = $type;
		}
		$where['status'] = 1;
		$list   = D('Config')->where($where)->select();
		$config = array();
		foreach ($list as $rs) {
			$config[$rs['type']][$rs['name']] = trim($rs['val']);
		}

		return $name ? $config[$type][$name] : $config[$type];
	}
}
?>